From 8dfb9dbc34dc88b6792026ecce85900d60746304 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Tue, 17 Mar 2026 04:21:09 +0100 Subject: [PATCH] quickSettings: Consider menu width when calculating its preferred height Previously the width of a menu was ignored when calculating its preferred height. This was leading to line wrapped text never being wrapped in these calculations and thus the menu being assumed to be shorter than it actually ends up when allocated with line wrapping. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6952 Part-of: --- js/ui/quickSettings.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/ui/quickSettings.js b/js/ui/quickSettings.js index 8a055e56b..6102ff252 100644 --- a/js/ui/quickSettings.js +++ b/js/ui/quickSettings.js @@ -667,10 +667,11 @@ const QuickSettingsLayout = GObject.registerClass({ return [this.nColumns * childMin + spacing, this.nColumns * childNat + spacing]; } - vfunc_get_preferred_height(container, _forWidth) { + vfunc_get_preferred_height(container, forWidth) { const rows = this._getRows(container); - let [minHeight, natHeight] = this._overlay.get_preferred_height(-1); + let [minHeight, natHeight] = + this._overlay.get_preferred_height(forWidth); const spacing = (rows.length - 1) * this.row_spacing; minHeight += spacing; @@ -688,12 +689,13 @@ const QuickSettingsLayout = GObject.registerClass({ vfunc_allocate(container, box) { const rows = this._getRows(container); - const [, overlayHeight] = this._overlay.get_preferred_height(-1); + const [, overlayHeight] = + this._overlay.get_preferred_height(box.get_width()); const availWidth = box.get_width() - (this.nColumns - 1) * this.column_spacing; const childWidth = Math.floor(availWidth / this.nColumns); - this._overlay.allocate_available_size(0, 0, box.get_width(), box.get_height()); + this._overlay.allocate_available_size(0, 0, box.get_width(), overlayHeight); const isRtl = container.text_direction === Clutter.TextDirection.RTL; -- 2.39.5